<?

$GLOBALS=$appList = array(
		'Contacts',
		'Returns',
		'Contracts',
		'Finance',
		'DWMaint'
);

function userAppRightExists($userId,$app){
	$appFile ="../../users/".$userId."/$app.app.inc";
	if (file_exists($appFile)) {
	    return true;
	}
}	


function userApplicationList($userId){
	// available application
	
	foreach($GLOBALS['appList'] as $app){
		if (userAppRightExists($userId, $app)) {
		    $userAppList[] = $app;
		}
	}
	return $userAppList;
}
?>